package 基础;

import java.io.*;
import java.util.Scanner;

//Scanner的读取
public class Demo_10 {
    public static void main(String[] args) throws FileNotFoundException {
//字符流
        try(Reader reader = new FileReader("./AAA1.txt");
            Scanner scanner = new Scanner(reader)){
            while(scanner.hasNext()){
                String s = scanner.next();
                System.out.println(s);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

//字节流
        try(InputStream inputStream1 = new FileInputStream("./AAA1.txt");
            Scanner scanner1 = new Scanner(inputStream1)){
            while(scanner1.hasNext()){
                String s = scanner1.next();
                System.out.println(s);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
